package org.vison.wonfu.framework.test.admin.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.vison.wonfu.framework.soa.Invocation;
import org.vison.wonfu.framework.soa.governance.circuitBreaker.Fallback;
import org.vison.wonfu.framework.test.admin.integration.model.BaseRes;
import org.vison.wonfu.framework.test.admin.integration.model.JsonRpcTO;

@Slf4j
@Service
public class PostmanEchoSoaEchoPostFallback implements Fallback {

    @Override
    public Object handle(Invocation invocation) {
        log.warn("Fallback invoked for method: {}", invocation.getMethodName());
        BaseRes<JsonRpcTO> res = new BaseRes<>();
        JsonRpcTO jsonRpcTO = new JsonRpcTO();
        jsonRpcTO.setMethod("fallback");
        res.setJson(jsonRpcTO);
        return res;
    }
}
